#include <stdio.h>

int N = 5;
int QUEUE[5], front = -1, rear = -1;

void enqueue(int x) 
{
    if (front == -1)
    {
        front = rear = 0;
        QUEUE[rear] = x;
        return;
    }
    else if (rear == N - 1)
    {
        printf("Overflow!\n");
        return;
    }
    rear++;
    QUEUE[rear] = x;
}

void dequeue()
{
    if (front == -1)
    {
        printf("Underflow!\n");
    }
    else if (front == rear)
    {
        front = rear = -1;
    }
    else
    {
        front++;
    }
}

void peek()
{
    if (front == -1) 
    {
        printf("EMPTY!\n");
        return;
    }
    printf("%d\n", QUEUE[front]);
}

void display()
{
    if (front == -1) 
    {
        printf("EMPTY!\n");
        return;
    }
    for (int i = front; i <= rear; i++)
    {
        printf("%d ", QUEUE[i]);
    }
    printf("\n");
}

int main()
{
    enqueue(2);
    enqueue(5);
    enqueue(-1);
    display();
    peek();
    dequeue();
    peek();
    display();
}